﻿#include "MyWidget.h"
#include "ui_MyWidget.h"
#include <QDebug>
#include <QMouseEvent>

MyWidget::MyWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MyWidget)
{
    ui->setupUi(this);
    //设置此属性，qss设置widget背景才能生效
    this->setAttribute(Qt::WA_StyledBackground);
}

MyWidget::~MyWidget()
{
    delete ui;
}

void MyWidget::mousePressEvent(QMouseEvent *event)
{
    qDebug() << QStringLiteral("点击了 x : %1; y : %2").arg(event->x()).arg(event->y());
}
